package org.springblade.tms.global.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;
import org.springblade.common.enums.Enumerator;
import org.springblade.tms.global.anno.SelectEnum;

/**
 * @projectName: BladeX
 * @package: org.springblade.tms.global.enums
 * @className: WaybillStatusEnum
 * @author: yr
 * @description: 运单状态枚举
 * @date: 2022/3/16 15:13
 */
@AllArgsConstructor
@Getter
@SelectEnum(value = "waybillStatus", desc = "运单状态枚举")
public enum WaybillStatusEnum implements Enumerator {
	ORDER_RECEIVED("orderReceived", "已接单"),
	LOADED("loaded", "待启运"),
	ARRIVE_AT_THE_TRANSFER_STATION("arriveAtTheTransferStation", "待到达中转站"),
	SHIPPED("shipped", "待送达"),
	ARRIVED("arrived", "待完成"),
	ABOLISHED("abolished", "已作废"),
	COMPLETED("completed", "已完成");
	private final String value;
	private final String description;

	@Override
	public String value() {
		return value;
	}

	@Override
	public String description() {
		return description;
	}

	public static String getDescriptionByValue(String value) {
		for (WaybillStatusEnum waybillStatusEnum : WaybillStatusEnum.values()) {
			if (waybillStatusEnum.getValue().equals(value)) {
				return waybillStatusEnum.getDescription();
			}
		}
		return null;
	}
}
